﻿@model smp.ButterflyCakes.Models.FormModels.Attachments.UploadFileModel
@{
    ViewBag.Title = "View Files";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div>
    <div class="row-fluid">
        <ul class="breadcrumb">
            <li><a href="/home/index/">Home</a><span class="divider">/</span></li>
            <li><a href="/order/edit/@Model.OrderId">Order</a><span class="divider">/</span></li>
            <li class="active">Images & Files</li>
        </ul>
    </div>
    <div class="row-fluid">
        <div class="navbar">
            <div class="navbar-inner">
                <div class="container">
                    <ul class="nav">
                        <li class="active"><a class="brand" href="#">Order Files</a> </li>
                        <li><a id="previous" href="/order/edit/@Model.OrderId">Back to order</a> </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class="row-fluid">
        <ul class="nav nav-tabs" id="filestab">
            <li class="active"><a class="tabclickable" href="#upload">Upload</a></li>
            <li><a class="tabclickable" href="#images">Images</a></li>
            <li><a class="tabclickable" href="#diagrams">Diagrams</a></li>
            <li><a class="tabclickable" href="#files">All Files</a></li>
        </ul>
        <div class="tab-content">
            <div class="tab-pane active" id="upload">
                <div class="container">
                    @if (Model.Uploaded)
                    {
                        <div class="row-fluid hide">
                            @if (Model.WasSuccessful)
                            {
                                <label class="label-success">
                                    Upload successful</label>
                            }
                            else
                            {
                                <label class="label-warning">
                                    Upload failed, please try again.</label>
                            }
                        </div>
                    }
                    <div class="row-fluid btn-group" data-toggle="buttons-radio">
                        <button id="imagefilebtn" type="button" class="btn btn-info active">
                            Upload an image</button>
                        <button id="filebtn" type="button" class="btn btn-info">
                            Upload a file</button>
                    </div>
                    <div id="filecontainer" class="row-fluid" >
                        <form class="form-actions" method="post" enctype="multipart/form-data" action="/attachment/UploadAFile">
                            @Html.HiddenFor(x => x.OrderId)
                            @Html.HiddenFor(x => x.IsImage)
                            <div class="control-group">
                                <label class="control-label" for="Titles">
                                    Select a file to upload</label>
                                <div class="controls">
                                    <input type="file" name="File" id="File"/>
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label" for="Description">
                                    Description</label>
                                <div class="controls">
                                    <textarea class="summary" rows="3" id="Description" name="Description" placeholder="Descripion"></textarea>
                                </div>
                            </div>
                            <div class="control-group">
                                <div class="controls">
                                    <div class="btn-group">
                                        <div class="btn-group pull-left">
                                            <button id="uploadFile" type="submit" class="btn btn-success">
                                                Upload
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            @Html.Partial("ViewFiles", Model.ViewFiles)
        </div>
    </div>
</div>
<script src="@Url.Content("~/Scripts/AddFiles.js")" type="text/javascript"></script>
